package com.example.big_job.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.big_job.R;

import java.util.List;

public class CommentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
    private Context context;
    private List<Integer> mDatas;

    public CommentAdapter(Context context, List<Integer> mDatas) {
        this.context = context;
        this.mDatas = mDatas;
    }
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view;
        view= LayoutInflater.from(context).inflate(R.layout.item_commment, parent, false);
        return new CommentAdapter.commentViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        CommentAdapter.commentViewHolder commentViewHolder=(CommentAdapter.commentViewHolder) holder;
        if (position==0){
            commentViewHolder.head.setImageResource(R.drawable.h0);
            commentViewHolder.cp1.setImageResource(R.drawable.v1);
            commentViewHolder.cp2.setImageResource(R.drawable.v2);
            commentViewHolder.cp3.setImageResource(R.drawable.v3);
            commentViewHolder.id.setText("老干妈");
            commentViewHolder.text.setText("今天来到的这个饭店，我从它开业开始到现在，已经去过差不多十次了。\n" +
                    "它是在这商场内，性价比比较高的一个饭店了，而且价格也不是很高，很实惠了。\n" +
                    "今天点的都是喜欢吃的，像凉拌木耳，这道菜是必点的，也是开胃菜（好像每次去吃饭都会点的菜）。\n" +
                    "今天的菜色不错，而且有几样菜是最近才有的（也许很早就出了，有半年时间没去过他家了）。");
        }else if (position==1){
            commentViewHolder.head.setImageResource(R.drawable.h1);
            commentViewHolder.cp1.setImageResource(R.drawable.v4);
            commentViewHolder.cp2.setImageResource(R.drawable.v5);
            commentViewHolder.cp3.setImageResource(R.drawable.v6);
            commentViewHolder.id.setText("大东");
            commentViewHolder.text.setText("这个是....这是高汤焦掉发出的香味，确实这样的话就不用沾酱了，高汤渗入皮之后，适度的焦黄确实让味道更香了啊，不过应该还不止这样，也不能说粉粉的，能让皮的口感这么清爽，应该是还有用山芋吧，每吃一个都有新的口感，感受新的味道，内馅柔润的好像要化掉一样，每嚼一口嘴里就溢满了鲜汁，微麻微辣的风味，轻轻的刺激着舌头，乍看之下，这些煎饺好像没有什么特别，其实里头下了不少让人吃起来回味无穷的功夫，没想到煎饺也能达到如此美味的地步，这是我头一次吃到的滋味...");
        }else if (position==2){
            commentViewHolder.head.setImageResource(R.drawable.h2);
            commentViewHolder.cp1.setImageResource(R.drawable.v7);
            commentViewHolder.cp2.setImageResource(R.drawable.v8);
            commentViewHolder.cp3.setImageResource(R.drawable.v9);
            commentViewHolder.id.setText("扁扁");
            commentViewHolder.text.setText("这个面，仿佛突然有一股强大的力量从体内涌出来，这个汤又醇厚又香浓，用大量的骨头经过很长时间熬出来的汤头，与其说在喝，不如说在吃，这个面经过揉打，咬起来嚼劲十足，我从来没吃过这么Q的面，面里面没有多余的调味，但是却与汤头十分搭配..");
        }else if (position==3){
            commentViewHolder.head.setImageResource(R.drawable.h3);
            commentViewHolder.cp1.setImageResource(R.drawable.v10);
            commentViewHolder.cp2.setImageResource(R.drawable.v11);
            commentViewHolder.cp3.setImageResource(R.drawable.v12);
            commentViewHolder.id.setText("猪哥");
            commentViewHolder.text.setText("好吃，只是把牛肉做成面的形状，照理说应该和吃牛肉差不多，但是这个口感太新奇了，面条和炒蛋的搭配，一同滑入口中，一咬下去，牛肉的肉汁溢出来，和炒蛋的配料配合在一起，产生浓郁香醇的滋味，乍看之下是单纯的`构想，可是竟然能产生这么新鲜的效果");
        }else if (position==4){
            commentViewHolder.head.setImageResource(R.drawable.h4);
            commentViewHolder.cp1.setImageResource(R.drawable.v13);
            commentViewHolder.cp2.setImageResource(R.drawable.v14);
            commentViewHolder.cp3.setImageResource(R.drawable.v15);
            commentViewHolder.id.setText("坤哥");
//            commentViewHolder.text.setText("");
        }else if (position==5){
            commentViewHolder.head.setImageResource(R.drawable.h5);
            commentViewHolder.cp1.setImageResource(R.drawable.v16);
            commentViewHolder.cp2.setImageResource(R.drawable.v17);
            commentViewHolder.id.setText("竹子哥");
//            commentViewHolder.text.setText("");
            commentViewHolder.cp3.setImageResource(R.drawable.v18);
        }else if (position==6){
            commentViewHolder.head.setImageResource(R.drawable.h6);
            commentViewHolder.cp1.setImageResource(R.drawable.v19);
            commentViewHolder.cp2.setImageResource(R.drawable.v20);
            commentViewHolder.cp3.setImageResource(R.drawable.v21);

//            commentViewHolder.text.setText("");
        }else if (position==7){
            commentViewHolder.head.setImageResource(R.drawable.h7);
            commentViewHolder.cp1.setImageResource(R.drawable.v22);
            commentViewHolder.cp2.setImageResource(R.drawable.v23);
            commentViewHolder.cp3.setImageResource(R.drawable.v24);
            commentViewHolder.id.setText("天哥");
//            commentViewHolder.text.setText("");
        }else if (position==8){
            commentViewHolder.head.setImageResource(R.drawable.h8);
            commentViewHolder.cp1.setImageResource(R.drawable.v25);
            commentViewHolder.cp2.setImageResource(R.drawable.v26);
            commentViewHolder.cp3.setImageResource(R.drawable.v27);
            commentViewHolder.id.setText("南哥");
//            commentViewHolder.text.setText("");
        }else if (position==9){
            commentViewHolder.head.setImageResource(R.drawable.h9);
            commentViewHolder.cp1.setImageResource(R.drawable.v28);
            commentViewHolder.cp2.setImageResource(R.drawable.v29);
            commentViewHolder.cp3.setImageResource(R.drawable.v30);
            commentViewHolder.id.setText("熊哥");
//            commentViewHolder.text.setText("");
        }
    }

    @Override
    public int getItemCount() {
        return 10;
    }

    public class commentViewHolder extends RecyclerView.ViewHolder{
        private ImageView head;
        private ImageView cp1;
        private ImageView cp2;
        private ImageView cp3;
        private TextView text;
        private TextView id;

        public commentViewHolder(@NonNull View itemView) {
            super(itemView);
            head=itemView.findViewById(R.id.c_head);
            cp1=itemView.findViewById(R.id.cp1);
            cp2=itemView.findViewById(R.id.cp2);
            cp3=itemView.findViewById(R.id.cp3);
            text=itemView.findViewById(R.id.ct0);
            id=itemView.findViewById(R.id.cid);
        }
    }
}
